﻿@using MvcCheckBoxList.Model
@using UnityWeb.Resources.User
@model UnityWeb.Models.User.EditUserViewModel


@{
    ViewBag.Title = Index.Title;
}

@using (Html.BeginForm("Edit", "User", FormMethod.Post, new { }))
{
    @TempData["comment"]
    <section class="accordion">
        <h3>EDIT USER</h3>
      <section class="pane">
        <fieldset>
          <legend></legend>
          <div class="field2 floatleft">
            <p>
              @Html.HiddenFor(m => m.UserName, new { @class = "UserNameHidden" })
              @Html.TextBoxFor(m => m.UserName, new { placeholder = @Index.UserName })
              @Html.ValidationMessageFor(m => m.UserName)
              @Html.HiddenFor(m => m.UserId)
            </p>
          </div>
          <div class="field2 floatright">
            <p>
              @Html.TextBoxFor(m => m.FirstName, new { placeholder = @Index.FirstName })
              @Html.ValidationMessageFor(m => m.FirstName)
            </p>
          </div>
          <div class="field2 floatleft">
            <p>
              @Html.PasswordFor(m => m.Password, new { placeholder = @Index.Password }) <a class="help" id="PasswordHelp">?</a>
              @Html.ValidationMessageFor(m => m.Password)
            </p>
          </div>
          <div class="field2 floatright">
            <p>
              @Html.TextBoxFor(m => m.LastName, new { placeholder = @Index.LastName })
              @Html.ValidationMessageFor(m => m.LastName)
            </p>
          </div>
          <div class="field2 floatleft">
            <p>
              @Html.PasswordFor(m => m.ConfirmPassword, new { placeholder = @Index.ConfirmPassword })
              @Html.ValidationMessageFor(m => m.ConfirmPassword)
            </p>
          </div>
          <div class="field2 floatright">
            <p>
              @Html.TextBoxFor(m => m.Email, new { placeholder = @Index.Email })
              @Html.ValidationMessageFor(m => m.Email)
            </p>
          </div>      
          <div class="col3 floatleft marginright15">
            <h4>Is locked out?</h4>
            @Html.TextBoxFor(m => m.IsLockedOut, new { @readonly = "readonly" })
          </div>
           <div class="col3 floatleft marginright15">
            <h4>Is Active?</h4>
            @Html.CheckBoxFor(m => m.IsApproved)
          </div>
          <div class="col3 floatleft marginright15">
            <h4>Role</h4>
            @Html.CheckBoxListFor(x => x.PostedRolesCheckBox.CheckBoxValues,
              x => x.AvailableRoleItems,
              x => x.Value,
              x => x.Text,
              x => x.SelectedRoleItems,
              Position.Vertical)
          </div>

          <div class="col3 floatleft marginright15">
            <h4>Domicile</h4>
            <div class="ddl">
              @Html.DropDownListFor(m => m.DomicileId, new SelectList(Model.Domiciles, "Value", "Text", "Select") , new { Id = "SelectDomicile"})
            </div>
            <div>
              @Html.ValidationMessageFor(m => m.DomicileId)
            </div>
          </div>
          <div class="field2 floatleft">
            <p>
              <h4>Available Management Companies</h4>
              <div id ="UserManCoes">
              </div>
            </p>
          </div>
          <div class="clearfix"></div>
          @if (Model.UserName != Model.LoggedOnUserName)
          {
            <div class="field2 floatleft">
              <p>
                <input type="submit" class="createuser" name="submitButton" value="Save" />
                @Html.ActionLink(Index.Back, "Index", "User", null, new { @class = "createuser" })
                <input type="submit" class="createuser" name="submitButton" value="Unlock User" @{if (!Model.IsLockedOut) { @: disabled="disabled"
                                                                                                                      } } />

              </p>
            </div>
          }
          else
          {
            <div class="field2 floatleft">
              <p>
                @Html.ActionLink(Index.Back, "Index", "User", null, new { @class = "createuser" })
              </p>
            </div>
          }
          <div class="clearfix"></div>
        </fieldset>
      </section>
    </section>
}

<div id="password-popover">
    @Html.Partial("_PasswordComplexity")
</div>

@section Scripts {
  <script src="@Url.Content("~/Scripts/User/user.js")" type="text/javascript"></script>
}


